//
//  NoteListItem.swift
//  WYYao
//
//  Created by wangcl on 2024/9/11.
//

import SwiftUI

class NoteItem:Identifiable,ObservableObject {
    var id = UUID()
    @Published var writeTime:String = ""
    @Published var title:String = ""
    @Published var  content:String = ""
    init(id: UUID = UUID(), writeTime: String, title: String, content: String) {
        self.id = id
        self.writeTime = writeTime
        self.title = title
        self.content = content
    }
}
struct NoteListItem: View {
    @ObservedObject var item:NoteItem
    var body: some View {
        HStack {
            VStack(alignment:.leading,spacing: 5) {
                Text(item.writeTime).cl_foregroundColor(.gray)
                Text(item.title).font(.title2).bold()
                Text(item.content).cl_foregroundColor(.gray).font(.system(size: 17)).lineLimit(1).multilineTextAlignment(.leading)
            }
            Spacer()
            Button(action: {}, label: {
                Image(systemName: "ellipsis")
                    .font(.system(size: 23))
            })
        }
    }
}

#Preview {
    List{
        NoteListItem(item: NoteItem(writeTime: "2024.09.11", title: "第一条笔记", content: "快来使用念头笔记记录生活吧～快来使用念头笔记记录生活吧～"))
    }.listStyle(.plain)
    
}
